package com.api.server.controller;


import com.api.server.pojo.*;
import com.api.server.service.IMaintainService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author shi
 * @since 2022-04-28
 */
@RestController
@RequestMapping("/maintain")
public class MaintainController {

    @Autowired
    private IMaintainService maintainService;

    //根据维护id查询维护信息
    @ApiOperation(value = "根据维护id查询维护信息")
    @PostMapping("/message")
    public RespBean message(String maintaintask){
        Maintain maintain = maintainService.message(maintaintask);
        return Result.success("获取维护信息成功！",maintain);
    }


    //增加维护
    @ApiOperation(value = "增加维护")
    @PostMapping
    public Result add(@RequestBody Maintain maintain){
        maintainService.add(maintain);
        return Result.success(201,"维护信息创建成功",maintain);
    }



    //根据维护信息类型/设施编号查看维护信息列表
    @ApiOperation(value = "根据维护信息类型/设施编号查看维护信息列表")
    @GetMapping("/maintains")
    public RespBean venues(UserListPage userListPage){
        Map<String,Object> map = maintainService.page(userListPage);
        return Result.success("获取维护信息列表成功！",map);
    }


}
